package org.c41.math;

import org.c41.util.Check;

public class Vector3D {

	private Rational x,y,z;
	
	public Vector3D(Rational x, Rational y, Rational z){
		Check.notNull(x);
		Check.notNull(y);
		Check.notNull(z);
		this.x=x;
		this.y=y;
		this.z=z;
	}
	
	public Rational getX(){
		return this.x;
	}
	
	public Rational getY(){
		return this.y;
	}
	
	public Rational getZ(){
		return this.z;
	}
	
	@Override
	public boolean equals(Object obj){
		if(!(obj instanceof Vector3D)){
			return false;
		}
		Vector3D v3d = (Vector3D)obj;
		return this.x.equals(v3d.x) && this.y.equals(v3d.y) && this.z.equals(v3d.z);
		
	}
	
	@Override
	public int hashCode(){
		return x.hashCode()*C41Math.pow(y.hashCode(), 2)*C41Math.pow(z.hashCode(), 3);
	}
	
	@Override
	public String toString(){
		return "("+x+", "+y+", "+z+")";
	}
	
}
